package com.chen.action;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts2.ServletActionContext;


/**
 * @author JohnSong
 * @date 2019/9/25 19:20
 **/
public class CaptchaAction extends ActionSupport {
    private String phone;

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }
    @Override
    public void validate(){
        String captcha=com.chen.util.captchaCode.code();
        ServletActionContext.getRequest().getSession().setAttribute("captcha",captcha);

        try {
            com.chen.util.PhoneUtil.sendCode(phone, captcha);

        } catch (Exception e) {
            e.printStackTrace();
        }

    }
}
